<!DOCTYPE html>
<html lang="zh-CN"><head>
		<title></title>
		<meta charset="utf-8">
		<meta content="" name="description">
		<meta content="" name="keywords">
		<meta content="eric.wu" name="author">
		<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
		<meta content="no-cache,must-revalidate" http-equiv="Cache-Control">
		<meta content="no-cache" http-equiv="pragma">
		<meta content="0" http-equiv="expires">
		<meta content="telephone=no, address=no" name="format-detection">
		<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
		<link rel="stylesheet" type="text/css" href="othertrendslist_files/main.css">
		<link rel="stylesheet" type="text/css" href="othertrendslist_files/dialog.css">
		<script src="othertrendslist_files/jquery_min.js"></script>
		<script src="othertrendslist_files/main.js"></script>
		<script src="othertrendslist_files/dialog_min.js"></script>
		<script>
		       function collectTrends(type, sid, tid, uid){
		    	   var args = arguments;
			        loading(true);
		    	    $.post('/snsmobile/collect',{
		    	        "type" : type,
		    	        "sid"  : sid,
		    	        "tid"  : tid,
		    	        "uid"  : uid,
			    	    },function(res){
			    	    	loading(false);
			    	    	if("1" == res){
	    		    	    	var $a = $("#collect_"+tid);
	    		    	    	var label = $a.find("label")[0];
	    		    	    	var total = parseInt(label.innerText );
	    		    	    	$a[0==type?"addClass":"removeClass"]("on");
	    		    	    	total = (0 == type)?total+1:total-1;
	    		    	    	label.innerText = total;
	    		    	    	$a.attr("onclick", 'collectTrends('+[1,0][type]+","+(Array.prototype.slice.call(args, 1).join(','))+');');
			    	    	}
			    	    });
		        }
		       function praiseTrends(type, sid, tid, uid){
		    	   var args = arguments;
		    	    loading(true);
		    	    $.post('/snsmobile/praise',{
		    	        "type" : type,
		    	        "sid"  : sid,
		    	        "tid"  : tid,
		    	        "uid"  : uid,
			    	    },function(res){
			    	    	loading(false);
			    	    	if("1" == res){
	    		    	    	var $a = $("#praise_"+tid);
	    		    	    	var label = $a.find("label")[0];
	    		    	    	var total = parseInt(label.innerText );
	    		    	    	$a[0==type?"addClass":"removeClass"]("on");
	    		    	    	total = (0 == type)?total+1:total-1;
	    		    	    	label.innerText = total;
	    		    	    	$a.attr("onclick", 'praiseTrends('+[1,0][type]+","+(Array.prototype.slice.call(args, 1).join(','))+');');
			    	    	}
			    	    });
		        }
		</script>
	</head>
	<body onselectstart="return true;" ondragstart="return false;" class="discuss_my discuss_my_tiezi">
		<div id="container" class="container">
			<header>
				<div class="header_1">
					<ul class="tbox">
						<li>
							<span class="head_img" 2="">
															<img src="othertrendslist_files/2.png" onerror="this.src='http://stc.weimob.com/img/sns/2.png';">
														</span>
						</li>
						<li>
							<h5>游客</h5>
							<p>
								
								<a href="javascript:void(0);" class="label"><span class="icons icons_vip_0">&nbsp;</span>非会员</a>
														</p>
						</li>
					</ul>
				</div>
			</header>
			<div class="body">
							<div id="list_article" class="list_article">
									<article>
						<header>
							<ul class="tbox">
								<li></li>
								<li>
                                    <h5>我想买台可以p图的电脑，大概五千左右</h5>
								    <p>2014-10-26 21:48:18</p>
								</li>
								<li>
									
								</li>
							</ul>
						</header>
						<section>
														<div>
							    <div>美工用的，整体性能稳定，分辩率高些。<img src="othertrendslist_files/4.gif" data-innerhtml="/:8-)"></div>
							</div>
							<a href="http://349257.m.weimob.com/snsmobile/commentlist?sid=349257&amp;tid=3533&amp;ruid=387016">查看全文</a>
						</section>
						<footer>
							<ul class="box">
								<li>
																    <a href="javascript:;" class="a_collect" id="collect_3533" onclick="collectTrends(0, 349257, 3533, 387016);"><span class="icons icons_collect">&nbsp;</span><label>0</label></a>
																</li>
								<li>
									<a href="http://349257.m.weimob.com/snsmobile/commentlist?sid=349257&amp;tid=3533&amp;ruid=387016" class="a_comment"><span class="icons icons_comment">&nbsp;</span><label>3</label></a>
								</li>
								<li>
																	<a href="javascript:;" class="a_like on" id="praise_3533" onclick="praiseTrends(1, 349257, 3533, 387016);"><span class="icons icons_like">&nbsp;</span><label>2</label></a>
																</li>
						    </ul>
						</footer>
					</article>
					
								</div>
						</div>
			<footer>
				<section class="nav_footer">
					<ul class="box">
						<li>
							<a href="http://349257.m.weimob.com/snsmobile?v=c870a293a4a5578b466f623abc1648e2&amp;pid=349257&amp;wechat_id=okthVt76nHZp7-wt88ED7szslHvw">
								<span class="icons_home">&nbsp;</span>
								<label>首页</label>
							</a>
						</li>
						<li>
                                						            <a href="http://349257.m.weimob.com/snsmobile/newtrends?pid=349257&amp;uid=387016&amp;exa_trends=0" class="nav_add">
							        <span class="icons_home_edit">&nbsp;</span>
							    							        </a>
						</li>
						<li>
							<a href="http://349257.m.weimob.com/snsmobile/trendslist?sid=349257&amp;uid=387016">
														    <span class="icons_my">&nbsp;</span>
															<label>我的</label>
							</a>
						</li>
					</ul>
				</section>
			</footer>
		</div>
	
	<script>
    $(document).ready(function(){
        
        var range = 50;             //距下边界长度/单位px  
       var pageNum = 2;  
        var totalheight = 0;   
        var main = $("#list_article");                //主体元素
       var state = 0;  
        var _srollPos = 0;

        var TPL = '<article {guan}>'+
                		' <header>'+
                		' <ul class="tbox">'+
                		' <li>'+
                		' 	<a href="{his_tiezi_href}" class="head_img">'+
                		' 		<img src="{head_img}" onerror="this.src=\'imgs/2.png\';" />'+
                		' 	</a>'+
                		' 	</li>'+
                		' <li>'+
                		' 	<h5>{nickname}</h5>'+
                		' 	<p>{ctime}</p>'+
                		' </li>'+
                		' <li>{edit_trend}</li>'+
                		' </ul>'+
                		' </header>'+
                		' <section>'+
                		' <figure data-count="{image_url_count}张图片" {show_pic}>'+
                		' <div>{imgs}</div>'+
                		' 	</figure>'+
                		' 		<div>'+
                		' 		<h5>{title}</h5>'+
                		' 		<div>{content}</div>'+
                		' 		<a href="{comment_href}">查看全文</a>'+
                		' 	</section>'+
                		' 	<footer>'+
                		' 		<ul class="box">'+
                		' 			<li>'+
                		' 				<a href="javascript:;"  id="collect_{tid}" class="a_collect {collect_on}" {collect_click} ><span class="icons icons_collect" >&nbsp;</span><label>{collect}</label></a>'+
                		' 			</li>'+
                		' 			<li>'+
                		' 						<a href="{comment_href}" class="a_comment"><span class="icons icons_comment" >&nbsp;</span><label>{comment}</label></a>'+
                	    ' 						</li>'+
                	    ' 						<li>'+
                	    ' 	<a href="javascript:;" id="praise_{tid}" class="a_like {praise_on}" {praise_click}><span class="icons icons_like"   >&nbsp;</span><label>{praise}</label></a>'+
                	    ' </li>'+
                	    ' 					</ul>'+
                	    ' 		</footer>'+
                	    ' </article>';

       var TPL_imgs = '<img src="{img_url}" data-src="{img_url}" data-gid="g{gi}" onload="preViewImg(this, event);"/>';
        
        $(window).scroll(function(){
            var pageSize = 15;
            var total = 1;
            if( Math.ceil(total/pageSize)<pageNum ){
                  return false;
            }
            var srollPos = $(window).scrollTop();    //滚动条距顶部距离(页面超出窗口的高度)  
           if(srollPos<_srollPos){
                return;
            }else{
            	_srollPos = srollPos;
            }
            totalheight = parseFloat($(window).height()) + parseFloat(srollPos);  
            if(!state && (($(document).height()-range) <= totalheight) ) {
          	    loading(true);
            	state = 1;
                $.post('/snsmobile/ajaxindex',{
                    "sid"  : 349257,
                    "ruid" : 387016,
                    "page" : pageNum
                    },function(res){
                        loading(false);
                        if(res) {
                            var data = $.parseJSON(res);
                            console.log(data);
                        html = iTemplate.makeList(TPL, data.rows, function(k,v){
                            console.log(v);
                            var gi = new Date().getTime();
                            var subObj = {
                                his_tiezi_href:'/snsmobile/othertrendslist?sid='+v.sid+'&uid='+v.uid+'&ruid='+v.ruid,
                                edit_trend:v.uid==v.ruid?'<a href="/snsmobile/trendsrow?pid='+v.sid+'&tid='+v.tid+'&exa_trends='+data.shopinfo.exa_trends+'" class="icons icons_edit">&nbsp;</a>':'',
                                head_img:"2"== v.type?( v.head_img||'http://stc.weimob.com/img/sns/2.png'):(data.shopinfo.image),
                                nickname:"2"== v.type?(v.nickname||'游客'):(data.shopinfo.nickname),
                                guan: "1"==v.type?'data-role="guan"':'',
                                image_url_count: v.image_url[0]? v.image_url.length:0,
                        		show_pic:v.image_url[0]?'':'style="display:none;"',
                                imgs: iTemplate.makeList(TPL_imgs, v.image_url, function(kk,vv){
                                    return {
                                         gi: gi 
                                       }
                                }),
                                praise_on:"1" == v.ispraise?'on':'',
                                collect_on:"1" == v.iscollect?'on':'',
                                praise_click: 'onclick="praiseTrends('+v.ispraise+', '+v.sid+', '+v.tid+', '+v.ruid+')"',
                                collect_click:'onclick="collectTrends('+v.iscollect+', '+v.sid+', '+v.tid+', '+v.ruid+')"',
                                comment_href: '/snsmobile/commentlist?sid='+v.sid+'&tid='+v.tid+'&ruid='+v.ruid,
                                ctime:(function(vctime){
                            	    var f_ctime = new Date(vctime);
                            	    var arr = [];
                            	    arr.push( f_ctime.getFullYear() );
                            	    arr.push( "-" + (f_ctime.getMonth()+1 ) );
                            	    arr.push( "-" + f_ctime.getDate() );
                            	    arr.push( " " + f_ctime.getHours() );
                            	    arr.push( ":" + f_ctime.getMinutes() );
                            	    arr.push( ":" + f_ctime.getSeconds() );
                            	    return arr.join("");
                                })(v.ctime*1000),
                               
                            };
                            return subObj;
                        });
                        main.append($(html) );
                        pageNum ++;
                        state = 0;
                    }else{
                    	loading(false);
                    	state = 0;
                    	alert("没有更多了...","1500");
                    }
                });
            }  
        });  
    }); 

	
    	document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
        WeixinJSBridge.call('hideOptionMenu');
    });
	</script>

</body></html>